﻿using System;
using Microsoft.AspNetCore.Mvc;
using System.Xml.Linq;
using VegetableSale.NET.Entities;
using VegetableSale.NET.Services;

namespace VegetableSale.NET.Controllers;

[ApiController]
[Route("api/[Action]")]
public class StockController : Controller
{
    private StockService stockService = new StockService();

    [HttpPost(Name = "stocklist")]
    public Result stocklist([FromBody] QueryDTO queryDTO)
    {
        return stockService.getStockList(queryDTO);
    }

    [HttpPost(Name = "stockaddstock")]
    public Result stockaddstock([FromBody] StockQuery stockQuery)
    {
        return stockService.addStock(stockQuery);
    }

    [HttpPost(Name = "stockdeletestock")]
    public Result stockdeletestock(int skid)
    {
        return stockService.deleteStock(skid);
    }

    [HttpPost(Name = "stockupdatestock")]
    public Result stockupdatestock([FromBody] StockUpdateQuery stockUpdateQuery)
    {
        return stockService.updateStock(stockUpdateQuery);
    }

}